#include "mainwindow.h"
#include <QDebug>
#include <QString>


MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    this->setWindowTitle("跳马");
    for(int a=0;a<X_;a++){
        for(int b=0;b<Y_;b++)
        {
            QLabel *labe = new QLabel(this);
            labe->setStyleSheet("background:red");
            labe->setGeometry(a*SIZE_,b*SIZE_,SIZE_-1,SIZE_-1);
            labe->show();
            matrix[a][b] = new Node;
            matrix[a][b]->label = labe;
            matrix[a][b]->X = a;
            matrix[a][b]->Y = b;
            matrix[a][b]->type = 1;
         }
    }
}

  //  matrix[x][y]->type = NORMAL_LABEL;

void MainWindow::display()
{

    for(int a=0;a<X_;a++){
        for(int b=0;b<Y_;b++)
        {
            if( matrix[a][b]->type==0)
                matrix[a][b]->label->close();
            else if(matrix[a][b]->type == 2)
                matrix[a][b]->label->setStyleSheet("background:blue");
            else if(matrix[a][b]->type == 3)
                matrix[a][b]->label->setStyleSheet("background:green");

        }

    }
}

MainWindow::~MainWindow()
{

}
